-
Notifications
You must be signed in to change notification settings - Fork 121
[Local catalog] Animate updates to the item list #16418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
[Local catalog] Animate updates to the item list #16418
Conversation
- Rename generic Identifier<T> to POSItemIdentifier - Remove siteID property (only work with one site at a time) - Structure simplified to (underlyingType, itemID) - Update all POSItem types to use POSItemIdentifier This makes the identifier system simpler and more focused on its purpose: stable identification for animations and deduplication. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Fix variation mapping to use .variation underlyingType - Remove siteID from all identifier creation - Update coupon mapping in fetch strategy 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Add posItemIdentifier property to CartItem protocol - PurchasableItem: Compute from loaded POSOrderableItem - CouponItem: Store POSItemIdentifier on creation - Update cart add() method to capture coupon identifier This enables comparison between cart items and POSItems using stable identifiers while maintaining UUID for cart animations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Uncomment and fix coupon duplicate check - Compare cart coupons using posItemIdentifier - Prevents duplicate coupons from being added to cart 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Update PreviewHelpers to use POSItemIdentifier - Update ScreenshotMock to use POSItemIdentifier - Fix ChildItemList previews with proper identifiers 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Fix hardcoded coupon itemID in PointOfSaleOrderController - Use posItemIdentifier from CartItem instead of hardcoding - Update test mocks to use POSItemIdentifier - Fix all UUID() usages in PointOfSaleItemServiceTests 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Replace UUID() with POSItemIdentifier in all test files - Use appropriate underlyingType (.product, .variation, .coupon) - Use meaningful itemID values (productID, variationID, or test IDs) Files updated: - POSOrderServiceTests.swift - GRDBObservableDataSourceTests.swift - POSProductOrVariationResolverTests.swift - POSCouponTests.swift - PointOfSaleItemMapperTests.swift - PointOfSaleCouponServiceTests.swift - CartViewHelperTests.swift - PointOfSaleAggregateModelTests.swift - PointOfSaleItemsControllerTests.swift - PointOfSaleOrderControllerTests.swift - PointOfSaleObservableItemsControllerTests.swift - POSItemActionHandlerFactoryTests.swift - POSItemActionHandlerTests.swift 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Instead of reusing `.loading` for error states in PurchasableItem.posItemIdentifier, we now have a dedicated `.error` case for clearer semantic meaning. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Updated all preview code in views to use the new POSItemIdentifier instead of UUID(). This includes: - CartView, CouponRowView, POSCouponCreationSheet - SimpleProductCardView, VariationCardView, CouponCardView - Auto-generated Models+Copiable.generated.swift Also fixed VariationCardView preview to use .variation instead of .product for the underlyingType. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Changed id property from UUID to POSItemIdentifier to match the updated POSOrderableItem protocol. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Changed coupon ID creation from UUID to POSItemIdentifier with sequential itemID values for test data. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Changed the id parameter type from UUID to POSItemIdentifier in the makeCartItem helper function. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Updated makeVariationItem() to use POSItemIdentifier instead of .init() and fixed makeCouponItem() to use .coupon instead of .product for the underlyingType. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Updated Cart.CouponItem and Cart.PurchasableItem test instantiations to use UUID for the id parameter and POSItemIdentifier for posItemIdentifier parameter, matching the updated dual-identifier architecture. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Added missing import for POSItemIdentifier. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Updated POSCoupon initialization to use POSItemIdentifier instead of .init() for the id parameter. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Added missing imports for POSItemIdentifier in test files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Updated Cart.CouponItem instantiations to use UUID for id and POSItemIdentifier for posItemIdentifier. Fixed makeItem() helper to use UUID instead of POSItemIdentifier. Changed coupon underlyingType from .product to .coupon. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Fixes compilation errors where POSItemIdentifier was not found in scope. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Updated makeSimpleProduct and makeVariation helper functions to use POSItemIdentifier instead of UUID, matching the updated type signatures. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Fixes compilation errors where POSItemIdentifier was not found in scope. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
|
|
iamgabrielma
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
| import Networking | ||
| import WooFoundation | ||
| import enum NetworkingCore.OrderStatusEnum | ||
| import struct Networking.PagedItems |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one can be removed, we're already importing Networking.
| let id = POSItemIdentifier(underlyingType: .coupon, itemID: coupon.couponID) | ||
| addedCouponItem = .coupon(.init(id: id, code: coupon.code, summary: coupon.summary(currencySettings: currencySettings))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hints that we could create the POSItemIdentifier internally within the POSItem rather than injecting it, have you had the chance to explore it, and if makes sense to do so?

Description
This PR animates changes in the item list. This only applies to adding/removing items at present. It's primarily visible using Local Catalog, in search.
The main blocker for this was that we used unstable UUIDs, as they would change when the item state changed. The main work in this PR is to change to use a new
POSItemIdentifierstruct for theIdentifiableconformance of items in the ItemList.We still use
UUIDforIdentifiableonCartItembut we have the item identifier as well. This is because we can have more than one row in the cart for each product, so we can't just use the product/variation/coupon identifier and expect it to be unique.Test Steps
Launch the app and open POS on a local catalog store.
Add or remove an item in WP-Admin
Pull to refresh
Observe that the item list updates are animated
Open search, and search for a term which will return multiple results.
Observe that the list changes are animated as you type.
Note that the animations aren't always perfect at the moment, but they're a lot better than none.
Screenshots
item.list.animations.mp4
RELEASE-NOTES.txtif necessary.